---
title: Python interpreter tool
---

<Warning>
This tool executes code and can potentially perform destructive actions. Be careful that you trust any code passed to it!
</Warning>

LangChain offers an experimental tool for executing arbitrary Python code.
This can be useful in combination with an LLM that can generate code to perform more powerful computations.

## Usage

import Pyinterpreter from "/snippets/javascript-integrations/examples/tools/pyinterpreter.mdx";

import IntegrationInstallTooltip from '/snippets/javascript-integrations/integration-install-tooltip.mdx';

<IntegrationInstallTooltip/>

```bash npm
npm install @langchain/openai @langchain/core
```

<Pyinterpreter />

## Related

- Tool [conceptual guide](/oss/langchain/tools)
- Tool [how-to guides](/oss/how-to/#tools)
